import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegxTest {

    public static void main(String[] args){
        String regx0="\\d{6}";
        String regx1="(?<![a-zA-Z0-9])([a-zA-Z0-9]{6})(?![a-zA-Z0-9])";
        testRegx(regx1,"尊金的121134用户hi你的验证码为121618，如有疑问请致电020-13243214谢谢");
    }

    public static void testRegx(String regx,String content){
        Pattern p=Pattern.compile(regx);
        Matcher m=p.matcher(content);
        if (m.find()){
            System.out.println("count: "+m.groupCount());
            for (int i=0;i<=m.groupCount();i++){
                System.out.println("match result: "+m.group(i));
            }
//            System.out.println("match result: "+m.group(0) );
        }else {
            System.out.println("failed");
        }
    }


}
